package com.juzipi.rabbit.controller;

import org.springframework.amqp.rabbit.core.RabbitTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @Author juzipi
 * @Date 2021/7/29 11:30
 * @Infor
 */
@RestController
public class DemoController {

    @Autowired
    private RabbitTemplate rabbitTemplate;


    public static final String demoQueue = "demo.queue";
    public static final String demoExchange = "demo.exchange";
    public static final String demoRouting = "demo.routing";


    @GetMapping("get")
    public String getSms(){
        String s = "要发送的消息";
        rabbitTemplate.convertAndSend(demoExchange,demoRouting,s);
        return "yes";
    }



}
